<!--
 * @Author: gxn
 * @Date: 2020-09-01 19:53:36
 * @LastEditors: gxn
 * @LastEditTime: 2020-09-01 20:21:55
 * @Description: file content
-->
<template>
  <el-tree
    :props="props"
    :data="data"
    highlight-current
    default-expand-all
    :expand-on-click-node="false"
    @current-change="onSelectChange"
  ></el-tree>
</template>

<script>
import util from "@/libs/util";

export default {
  name: "my-instruction-tree",
  data() {
    return {
      data: null,
      defaultKey:[],
      props: {
        children: "children",
        label: "name",
        disabled: "disabled",
        value: "id"
      }
    };
  },
  created() {
    this.$api.admin_equipmentmodel_getList().then(res => {
      this.data = util.getTree(res);
    });
  },
  methods: {
    onSelectChange(data, node) {
      this.$emit("change", data, node);
    }
  }
};
</script>

<style lang="less">
</style>
